import 'package:bloc/bloc.dart';

import 'event.dart';
import 'state.dart';

class TestBloc extends Bloc<TestEvent, TestState> {
  TestBloc() : super(TestState().init()) {
    on<InitEvent>(_init);
    on<AddCountEvent>(_addCount);
  }

  void _init(InitEvent event, Emitter<TestState> emit) async {
    emit(state.clone());
  }
  void _addCount(AddCountEvent event, Emitter<TestState> emit) async {
    state.count ++;
    emit(state.clone());
  }
}
